package com.ccp.dev.qbdms.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ccp.dev.core.basic.annotion.Action;
import com.ccp.dev.core.basic.consts.UrlConstants;
import com.ccp.dev.core.basic.engine.GroovyScriptEngine;
import com.ccp.dev.core.basic.internationalization.SysBaseController;
import com.ccp.dev.core.basic.response.ResultData;
import com.ccp.dev.core.basic.util.ContextUtil;
import com.ccp.dev.core.basic.web.query.QueryFilter;
import com.ccp.dev.core.poi.excel.reader.TableEntity;
import com.ccp.dev.core.util.BeanUtils;
import com.ccp.dev.core.util.RequestUtil;
import com.ccp.dev.core.util.StringUtil;
import com.ccp.dev.core.util.log.SysAuditThreadLocalHolder;
import com.ccp.dev.extend.service.ExtendSysOrgService;
import com.ccp.dev.form.service.impl.ScriptImpl;
import com.ccp.dev.qbdms.consts.ZhiLiangConst;
import com.ccp.dev.qbdms.expimp.CustomExcelReader;
import com.ccp.dev.qbdms.expimp.util.AbstractExpUtil;
import com.ccp.dev.qbdms.expimp.util.AbstractImpUtil;
import com.ccp.dev.qbdms.expimp.util.AuxiliaryUtil;
import com.ccp.dev.qbdms.model.WFlightRewardsProject;
import com.ccp.dev.qbdms.model.WQbdXhdh;
import com.ccp.dev.qbdms.model.WRewardsMoneyAllocation;
import com.ccp.dev.qbdms.service.WFlightRewardsProjectService;
import com.ccp.dev.qbdms.service.WQbdXhdhService;
import com.ccp.dev.qbdms.service.WRewardsMoneyAllocationService;
import com.ccp.dev.qbdms.util.BaseUtil;
import com.ccp.dev.qbdms.util.StructureModifyUtil;
import com.ccp.dev.system.model.Dictionary;
import com.ccp.dev.system.model.SysOrg;
import com.ccp.dev.system.service.DictionaryService;
import com.ccp.dev.system.service.SysOrgService;
import com.ccp.dev.system.service.SysUserService;
import org.apache.commons.lang.StringEscapeUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * 飞行试验奖惩项目管理 信息操作处理控制器
 *
 * @author hw
 * @date 2020-05-25 15:16:44
 */
@Controller
/**
 * 请将此名称添加到日志开关
 */
@Action(customModel = "飞行试验奖惩项目管理")
@RequestMapping("/qbdms/wFlightRewardsProject")
public class WFlightRewardsProjectController extends SysBaseController{
    @Resource
    private WFlightRewardsProjectService wFlightRewardsProjectService;
    @Resource
    private DictionaryService dictionaryService;
    @Resource
    private WRewardsMoneyAllocationService wRewardsMoneyAllocationService;
    @Resource
    private WQbdXhdhService wQbdXhdhService;
    @Resource
    private SysOrgService sysOrgService;
    @Resource
    private ExtendSysOrgService extendSysOrgService;
    @Resource
    private ScriptImpl scriptImpl;
    @Resource
    private GroovyScriptEngine engine;
    @Resource
    private SysUserService sysUserService;
    public List<Dictionary> getOriginOrgToDicList() {
        List<SysOrg> sysOrgList = extendSysOrgService.getSubLevelOrg();
        sysOrgList = sysOrgList.stream().filter(sysOrg -> sysOrg.getIsTenant() == 1).collect(Collectors.toList());
        List<Dictionary> dicList = new ArrayList<>();
        for (SysOrg sysOrg : sysOrgList) {
            Dictionary dictionary = new Dictionary();
            dictionary.setItemName(sysOrg.getOrgName());
            dictionary.setItemValue(sysOrg.getCode());
            dicList.add(dictionary);
        }
        return dicList;
    }

    public List<Dictionary> getXhdhToDicList(){
        List<WQbdXhdh> xhdhList = wQbdXhdhService.getAll();
        List<Dictionary> dicList = new ArrayList<>();
        for(WQbdXhdh wQbdXhdh : xhdhList){
            Dictionary dictionary = new Dictionary();
            dictionary.setItemName(wQbdXhdh.getfModelname());
            dictionary.setItemValue(wQbdXhdh.getId());
            dicList.add(dictionary);
        }
        return dicList;
    }

    /**
     * 功能描述: 跳转到首页
     *
     * @return: java.lang.String
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + UrlConstants.MODULE_FUNCTION_LIST)
    @Action(description="跳转到飞行试验奖惩项目管理首页", exectype = "页面跳转日志")
    public String viewList(HttpServletRequest request, ModelMap modelMap) {
        List<WQbdXhdh> xhdhList = wQbdXhdhService.getAll();
        BaseUtil.SystemLevel currentSystemLevel = BaseUtil.getCurrentSystemLevel();
        modelMap.put("currentUserId", scriptImpl.getCurrentUserId());
        modelMap.put("xhdhList", JSON.toJSONString(xhdhList));
        // 返回当前系统等级
        modelMap.put("currentSystemLevel", currentSystemLevel);
        return "wFlightRewardsProject/list";
    }

    /**
     * 功能描述: 附带检索条件的分页查询
     *
     * @param: [request] http请求
     * @return: java.lang.Object
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping(UrlConstants.MODULE_FUNCTION_LIST)
    @ResponseBody
    @Action(description="附带检索条件的分页查询飞行试验奖惩项目管理",detail="查询数据信息<#if success>成功<#else></#if>")
    public Object list(HttpServletRequest request) {
        QueryFilter queryFilter = new QueryFilter(request, true);

        //添加用户密级
        ZhiLiangConst.addQueryFilter(queryFilter);
        //分页数据
        List<WFlightRewardsProject> pageDatas = wFlightRewardsProjectService.queryList(queryFilter);


        List<Dictionary> dicList = dictionaryService.getDicByNodeKey("mj", false);

        try {
            ZhiLiangConst.showName(pageDatas);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        //总体单位名称
        List<Dictionary> ztdwmcList = dictionaryService.getDicByNodeKey("ztdwmc", false);
        pageDatas.stream().forEach(wFlightRewardsProject -> {
            ztdwmcList.forEach(a->{
                if(a.getItemValue().equals(wFlightRewardsProject.getTotalityunitcode())){
                    wFlightRewardsProject.setTotalityunitcode(a.getItemName());
                }
            });
        });

        //型号名称
        List<Dictionary> xhmcList = getXhdhToDicList();
        pageDatas.stream().forEach(wFlightRewardsProject -> {
            xhmcList.forEach(a->{
                if(a.getItemValue().equals(wFlightRewardsProject.getModelname())){
                    wFlightRewardsProject.setModelname(a.getItemName());
                }
            });
        });

        // 添加编辑按钮权限控制
        ZhiLiangConst.isDataAllowEdit(pageDatas, false);

        SysAuditThreadLocalHolder.putParamerter("success",true);
        return success(pageDatas, queryFilter.getPageBean().getTotalCount());
    }


    /**
     * 功能描述: 跳转到新增页面
     *
     * @return: java.lang.String
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + UrlConstants.MODULE_FUNCTION_ADD_UPDATE)
    @Action(description="跳转到飞行试验奖惩项目管理新增页面", exectype = "页面跳转日志")
    public String viewAdd(HttpServletRequest request,ModelMap modelMap) {
        String id = RequestUtil.getString(request,"id");
        modelMap.put("id",id);
        // 密级
        List<Dictionary> mjList = dictionaryService.getDicByNodeKey("mj", false);
        //型号名称
        List<Dictionary> xhmcList = getXhdhToDicList();
        //项目阶段
        List<Dictionary> xmjdList = dictionaryService.getDicByNodeKey("xmjd",false);
        //项目类型
        List<Dictionary> xmlxList = dictionaryService.getDicByNodeKey("xmlx",false);
        //项目类别
        List<Dictionary> xmlbList = dictionaryService.getDicByNodeKey("xmlb",false);
        //主管部门
        List<Dictionary> zgbmList = dictionaryService.getDicByNodeKey("zgbm",false);
        //单位类别
        List<Dictionary> dwlbList = dictionaryService.getDicByNodeKey("swlb",false);
        //总体单位名称(数据字典)
        List<Dictionary> ztdwmcList = dictionaryService.getDicByNodeKey("ztdwmc",false);
//        List<Dictionary> ztdwmcList = dictionaryService.getDicByNodeKey("ejdw",false);
        //配套关系级别
        List<Dictionary> ptgxjbList = dictionaryService.getDicByNodeKey("ptgxjb",false);
        modelMap.put("mjList", JSON.toJSONString(mjList));
        modelMap.put("xhmcList", JSON.toJSONString(xhmcList));
        modelMap.put("xmjdList", JSON.toJSONString(xmjdList));
        modelMap.put("xmlxList", JSON.toJSONString(xmlxList));
        modelMap.put("xmlbList", JSON.toJSONString(xmlbList));
        modelMap.put("zgbmList", JSON.toJSONString(zgbmList));
        modelMap.put("dwlbList", JSON.toJSONString(dwlbList));
        modelMap.put("ztdwmcList", JSON.toJSONString(ztdwmcList));
        modelMap.put("ptgxjbList", JSON.toJSONString(ptgxjbList));

        if (StringUtil.isEmpty(id)) {
            // 新增
            // 填报信息
            modelMap.put("filldept", engine.executeObject("return scriptImpl.getCurrentOrgName();", null).toString());
            modelMap.put("fillman", engine.executeObject("return scriptImpl.getCurrentName();", null).toString());
            modelMap.put("filldate", engine.executeObject("return scriptImpl.getCurrentDate();", null).toString());
        } else {
            try {
                // 编辑
                WFlightRewardsProject wFlightRewardsProject = wFlightRewardsProjectService.getOneById(id);
                // 填报信息
                modelMap.put("filldept", wFlightRewardsProject.getFilldept());
                modelMap.put("fillman", wFlightRewardsProject.getFillman());
                modelMap.put("filldate", wFlightRewardsProject.getFilldate());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return "wFlightRewardsProject/add";
    }

    /**
     * 功能描述:  数据保存通用方法
     *
     * @param: wFlightRewardsProject 保存的对象
     * @return: java.lang.Object
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping(UrlConstants.MODULE_FUNCTION_SAVE)
    @ResponseBody
    @Action(description="保存飞行试验奖惩项目管理数据",detail="<#if isAdd>新增<#else>编辑</#if>飞行试验奖惩项目管理数据<#if success>成功<#else>失败</#if><#if StringUtil.isNotEmpty(modifyInfo)>${modifyInfo}</#if>")
    public Object save(@RequestBody WFlightRewardsProject wFlightRewardsProject) {
        String id = wFlightRewardsProject.getId();
        int result;
        if (StringUtil.isEmpty(id)) {
            SysAuditThreadLocalHolder.putParamerter("isAdd",true);
            //新增操作
            //新增数据前生成随机Id
            wFlightRewardsProject.setReportStatus(ZhiLiangConst.getDataInitStatusToHospital());
            //未经过编审
            wFlightRewardsProject.setIsbz("0");
            result = wFlightRewardsProjectService.add(wFlightRewardsProject);
        } else {
            SysAuditThreadLocalHolder.putParamerter("success",false);
            wFlightRewardsProject.setAccessory(StringEscapeUtils.unescapeHtml(wFlightRewardsProject.getAccessory()));

            WFlightRewardsProject oldWFlightRewardsProject = wFlightRewardsProjectService.getOneById(id);
            String modifyInfo = StructureModifyUtil.getModifyInfo(oldWFlightRewardsProject, wFlightRewardsProject);
            SysAuditThreadLocalHolder.putParamerter("modifyInfo",modifyInfo);
            ZhiLiangConst.updateCommonFields(wFlightRewardsProject);

            //修改操作
            result = wFlightRewardsProjectService.update(wFlightRewardsProject);
        }
        if(result > 0){
            SysAuditThreadLocalHolder.putParamerter("success",true);
        }else{
            SysAuditThreadLocalHolder.putParamerter("success",false);
        }
        return result > 0 ? getResultDataSuccess("save.success") : getResultDataError("save.failure");
    }

    /**
     * 功能描述: 跳转到详情页面
     *
     * @return: java.lang.String
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/particulars")
    @Action(description="跳转到飞行试验奖惩项目管理详情页面", exectype = "页面跳转日志")
    public String viewParticulars(HttpServletRequest request,ModelMap modelMap) {
        String id = RequestUtil.getString(request,"id");
        modelMap.put("id",id);
        String isClose = RequestUtil.getString(request,"isClose");
        modelMap.put("isClose",isClose);
        // 密级
        List<Dictionary> mjList = dictionaryService.getDicByNodeKey("mj", false);
        //型号名称
        List<Dictionary> xhmcList = getXhdhToDicList();
        //项目阶段
        List<Dictionary> xmjdList = dictionaryService.getDicByNodeKey("xmjd",false);
        //项目类型
        List<Dictionary> xmlxList = dictionaryService.getDicByNodeKey("xmlx",false);
        //项目类别
        List<Dictionary> xmlbList = dictionaryService.getDicByNodeKey("xmlb",false);
        //主管部门
        List<Dictionary> zgbmList = dictionaryService.getDicByNodeKey("zgbm",false);
        //单位类别
        List<Dictionary> dwlbList = dictionaryService.getDicByNodeKey("swlb",false);
        //总体单位名称
        List<Dictionary> ztdwmcList = dictionaryService.getDicByNodeKey("ztdwmc", false);
        //配套关系级别
        List<Dictionary> ptgxjbList = dictionaryService.getDicByNodeKey("ptgxjb",false);
        modelMap.put("mjList", JSON.toJSONString(mjList));
        modelMap.put("xhmcList", JSON.toJSONString(xhmcList));
        modelMap.put("xmjdList", JSON.toJSONString(xmjdList));
        modelMap.put("xmlxList", JSON.toJSONString(xmlxList));
        modelMap.put("xmlbList", JSON.toJSONString(xmlbList));
        modelMap.put("zgbmList", JSON.toJSONString(zgbmList));
        modelMap.put("dwlbList", JSON.toJSONString(dwlbList));
        modelMap.put("ztdwmcList", JSON.toJSONString(ztdwmcList));
        modelMap.put("ptgxjbList", JSON.toJSONString(ptgxjbList));
        return "wFlightRewardsProject/particulars";
    }

    /**
     * 功能描述: 根据主键id获取一条数据的通用查询方法
     *
     * @param: id 参数对象必须是"id"
     * @return: java.lang.Object
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping(UrlConstants.MODULE_FUNCTION_GET)
    @ResponseBody
    @Action(description="根据主键id查询飞行试验奖惩项目管理的一条数据",detail="根据主键id查询飞行试验奖惩项目管理的数据<#if success>成功<#else>失败</#if>")
    public Object get(@RequestParam("id") String id) {
        WFlightRewardsProject wFlightRewardsProject = wFlightRewardsProjectService.getOneById(id);
        wFlightRewardsProject.setYearToTime(wFlightRewardsProject.getYear().getTime());
        List<WRewardsMoneyAllocation> wRewardsMoneyAllocations = wRewardsMoneyAllocationService.getListByRefId(id);
        wFlightRewardsProject.setAccessory(StringEscapeUtils.unescapeHtml(wFlightRewardsProject.getAccessory()));
        wFlightRewardsProject.setwRewardsMoneyAllocationList(wRewardsMoneyAllocations);
        if (null == wFlightRewardsProject) {
            SysAuditThreadLocalHolder.putParamerter("success",false);
            return getResultDataError("get.failure");
        }
        SysAuditThreadLocalHolder.putParamerter("success",true);
        return getResultDataSuccess("get.success",wFlightRewardsProject);
    }

    /**
     * 功能描述: 根据主键ID删除数据的通用删除方法
     *
     * @param: id 参数名称必须是"id"
     * @return: java.lang.Object
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @PostMapping(UrlConstants.MODULE_FUNCTION_DELETE)
    @ResponseBody
    @Action(description="根据主键ID删除飞行试验奖惩项目管理数据",exectype = "删除日志",detail="删除数据信息<#if success>成功<#else>失败</#if>")
    public Object delete(@RequestParam("id") String id) {
        String userId = ContextUtil.getCurrentUserId();
        String[] ids = id.split(",");
        for (String key : ids) {
            WFlightRewardsProject wQbdFalProblemreset = wFlightRewardsProjectService.getOneById(key);
            if (Objects.nonNull(wQbdFalProblemreset.getReportStatus())
                    && !ZhiLiangConst.REPORT_STATUS_GROUPTOBEREPORTED.equals(wQbdFalProblemreset.getReportStatus())) {

                SysAuditThreadLocalHolder.putParamerter("success", false);
                return fail("删除失败，只允许删除待报集团的数据");
            }
            if (!userId.equals(wQbdFalProblemreset.getCreateBy())) {
                SysAuditThreadLocalHolder.putParamerter("success", false);
                return fail("删除失败，只能删除自己创建的数据！");
            }
        }

        if (StringUtil.isEmpty(id)) {
            SysAuditThreadLocalHolder.putParamerter("success",false);
            return fail("delete.failure.message");
        }
        int result = wFlightRewardsProjectService.delByIdArray(id.split(","));
        if(result > 0){
            SysAuditThreadLocalHolder.putParamerter("success",true);
        }else{
            SysAuditThreadLocalHolder.putParamerter("success",false);
        }
        return result > 0 ? getResultDataSuccess("delete.success") : getResultDataError("delete.failure");
    }

    /**
     * 功能描述: 跳转到导入页面
     *
     * @return: java.lang.String
     * @auther: hw
     * @date: 2019-12-25 19:21:40
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/import")
    @Action(description="跳转到飞行试验奖惩项目管理导入页面", exectype = "页面跳转日志")
    public String viewImport() {
        return "wFlightRewardsProject/import";
    }

    /**
     * 功能描述: 跳转到导出选择字段页面
     *
     * @return: java.lang.String
     * @auther: hw
     * @date: 2019-12-25 19:21:40
     */
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX + "/export")
    @Action(description="跳转到质量问题导出选择字段页面", exectype = "页面跳转日志")
    public String export(HttpServletRequest request,ModelMap modelMap) throws Exception {
        JSONObject jsonObject = AuxiliaryUtil.resolverModel(WFlightRewardsProject.class);
        modelMap.put("tableInfo",jsonObject.toString());
        return "expImp/add";
    }

    /**
     * 功能描述: 导出飞行试验奖惩项目管理数据信息
     *
     * @param: [request] http请求
     * @return: java.lang.Object
     * @auther: hw
     * @date: 2020-05-25 15:16:44
     */
    @RequestMapping("/exportData")
    @Action(description="导出飞行试验奖惩项目管理数据信息",detail="导出飞行试验奖惩项目管理数据信息<#if success>成功<#else></#if>")
    public void export(HttpServletRequest request, HttpServletResponse response) throws Exception{
        SysAuditThreadLocalHolder.putParamerter("success",false);
        String[] id = RequestUtil.getStringAryByStr(request,"id");
        QueryFilter queryFilter = new QueryFilter(request,false);
        JSONArray dataArray = ZhiLiangConst.exportAddConditions(queryFilter,id);
        List<WFlightRewardsProject> wFlightRewardsProjects = this.wFlightRewardsProjectService.queryAll(queryFilter);
        if(wFlightRewardsProjects.isEmpty()){
            wFlightRewardsProjects.add(new WFlightRewardsProject());
        }
        new AbstractExpUtil() {
            @Override
            public String customAnalysis(String fieldName, String fieldValue) {
                return null;
            }
        }.executeExport(request,response,wFlightRewardsProjects,dataArray, AbstractExpUtil.ExpStyle.MANY_SHEET);
        SysAuditThreadLocalHolder.putParamerter("success",true);
    }

    /**
     * 导入资源文件
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("/importData")
    @ResponseBody
    public ResultData importData(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception{
        SysAuditThreadLocalHolder.putParamerter("success",false);
        MultipartFile multipartFile = request.getFile("file");
        TableEntity excelEntity = new CustomExcelReader().readFile(multipartFile.getInputStream());
        List<WQbdXhdh> xhdhList = wQbdXhdhService.getAll();
        Map<String, Object> map = new AbstractImpUtil() {
            @Override
            public ReturnType customValidation(String fieldName, String fieldValue) {
                ReturnType returnType = null;
                if("totalityunitcode".equals(fieldName) || "rewardsUnitName".equals(fieldName)){
                    returnType = new ReturnType();
                    if(BaseUtil.SystemLevel.GROUPLEVEL.equals(BaseUtil.getCurrentSystemLevel())){
                        List<SysOrg> sysOrgs = sysOrgService.queryByOrgName(fieldValue);
                        if(BeanUtils.isNotEmpty(sysOrgs)&&StringUtil.isNotEmpty(sysOrgs.get(0).getOrgName())){
                            returnType.setNewValue(sysOrgs.get(0).getCode());
                        }else{
                            returnType.setMsg("非法的值!");
                        }
                    }else{
                        List<Dictionary> dictionaries = dictionaryService.getByNodeKey("ztdwmc");
                        List<Dictionary> dictionaryList = dictionaries.stream().filter(a->a.getItemName().equals(fieldValue)).collect(Collectors.toList());
                        if(BeanUtils.isNotEmpty(dictionaryList)&&StringUtil.isNotEmpty(dictionaryList.get(0).getItemValue())){
                            returnType.setNewValue(dictionaryList.get(0).getItemValue());
                        }else{
                            returnType.setMsg("非法的值!");
                        }
                    }
                }else if("modelname".equals(fieldName)){
                    returnType = new ReturnType();
                    boolean sign = true;
                    for(WQbdXhdh xhdh : xhdhList){
                        if (xhdh.getfModelname().equals(fieldValue)) {
                            sign = false;
                            break;
                        }
                    }
                    if(sign){
                        returnType.setMsg("非法的值!");
                    }
                }
                return returnType;
            }
        }.reverseModels(excelEntity, WFlightRewardsProject.class);
        String msg = map.get("msg").toString();
        List<WFlightRewardsProject> list = (List<WFlightRewardsProject>)map.get("instList");
        if(StringUtil.isEmpty(msg)){
            this.wFlightRewardsProjectService.addImportData(list);
            SysAuditThreadLocalHolder.putParamerter("success",true);
            return getResultDataSuccess("dataSource.importXml.success");
        }else{
            SysAuditThreadLocalHolder.putParamerter("success",false);
            return fail(msg);
        }
    }

    /**
     * 查询上报的信息
     *
     * @param request
     * @param id
     * @param tableName
     * @return
     */
    @RequestMapping("/reportList")
    @ResponseBody
    public Object reportList(HttpServletRequest request, @RequestParam("id") String id, @RequestParam("tableName") String tableName) {
        //业务数据
        List<WFlightRewardsProject> reportList = wFlightRewardsProjectService.reportList(id, tableName);
        //总体单位名称
        List<Dictionary> ztdwmcList = dictionaryService.getDicByNodeKey("ztdwmc", false);
        reportList.stream().forEach(wFlightRewardsProject -> {
            try {
                ztdwmcList.forEach(a->{
                    if(a.getItemValue().equals(wFlightRewardsProject.getTotalityunitcode())){
                        wFlightRewardsProject.setTotalityunitname(a.getItemName());
                    }
                });
                wFlightRewardsProject.setReportStatusStr(ZhiLiangConst.getStatusStrByInt(wFlightRewardsProject.getReportStatus()));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        });

        //型号名称
        List<Dictionary> xhmcList = getXhdhToDicList();
        reportList.stream().forEach(wFlightRewardsProject -> {
            try {
                xhmcList.forEach(a->{
                    if(a.getItemValue().equals(wFlightRewardsProject.getModelname())){
                        wFlightRewardsProject.setModelname(a.getItemName());
                    }
                });
                wFlightRewardsProject.setReportStatusStr(ZhiLiangConst.getStatusStrByInt(wFlightRewardsProject.getReportStatus()));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        });
        SysAuditThreadLocalHolder.putParamerter("success", true);
        return getResultDataSuccess("options.success", reportList);
    }
}
